import Vue from 'vue'
import Vuex from 'vuex'
// import createPersistedState from 'vuex-persistedstate'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  plugins: [
    createPersistedState(),
    // createPersistedState({
    //   storage: window.sessionStorage,
    // reducer(val) {
    //   return {
    //     // 只存储state中的userData
    //     userData: val.userData
    //   }
    // }
    // }),

  ],
  // plugins: [
  //   createPersistedState(),
  // ],
  state: {
    SONG_lIST:[],
    index:1
  },
  getters: {
  },
  mutations: {
    // INIT_SONG(state,payload){
    //   state.SONG_lIST = payload.SONG_lIST
    // },
    changeSONG_lIST(state,payload){
      console.log(state)
      console.log(payload)
      state.SONG_lIST = payload
    },
    changeIndex(state,payload){
      console.log(state)
      console.log(payload)
      state.index = payload
    },
  },
  actions: {
  },
  modules: {
  }
})
